package com.zhihuichongcheng.application.ui.approval.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.zhihuichongcheng.application.R;
import com.zhihuichongcheng.application.base.BaseActivity;
import com.zhihuichongcheng.application.bean.approval.Tasks;
import com.zhihuichongcheng.application.ui.approval.adapter.ApprovalCommentAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by 3water on 2016/11/14.
 */

public class ApprovalCommentActivity extends BaseActivity {

    private RecyclerView mRcvComment;
    private ApprovalCommentAdapter mAdapter;
    private List<Tasks> mListdata = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_approval_comment);
        initView();
        initData();
    }

    private void initView() {
        setTitle("意见详情");
        mRcvComment = (RecyclerView) findViewById(R.id.rcv_comment);
        mAdapter = new ApprovalCommentAdapter(mContext);
        mRcvComment.setLayoutManager(new LinearLayoutManager(mContext));
        mRcvComment.setAdapter(mAdapter);
    }

    private void initData() {
        Intent intent = getIntent();
        if (intent != null) {
            if (intent.hasExtra("comment")) {
                mListdata = intent.getParcelableArrayListExtra("comment");
            }
        }
        mAdapter.setData(mListdata);
        mAdapter.notifyDataSetChanged();
    }
}
